#pragma once
#include "Application.h"
#include "view\IView.h"

class Presenter {
public:

  /// Constructor
  Presenter() {}

  /// Destructor
  virtual ~Presenter() {}

  /// Initializer method
  virtual void Init() {}

  virtual int HandleEvents() { return 1; }

  virtual void Notify() {
  }

  void RegisterView(IView *view) {
    view_ = view;
  }

  void Quit() {
    system_->Quit();
  }

protected:
  void set_view(IView *view) {
    view_ = view;
  }

  IView *view() {
    return view_;
  }

  virtual void InitView() {
    view_->Init();
  }
  virtual void RenderView() {
    view_->Render();
  }
  virtual void SignalError(std::string errormsg) {
    view_->SignalError(errormsg);
  }


private:
  IView *view_;
  Application *system_;
};